/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.machineryrental.dao;

import cz.muni.fi.pa165.machineryrental.entities.Customer;
import java.util.List;

/**
 * DAO for Customer entity with base CRUD methods and some 
 * specific methods for customers.
 * 
 * @author David Katuscak, 359273
 */
public interface CustomerDAO {
    
    /**
     * Return Customer with given id
     * @param id id of the Customer that we are looking for
     * @return Customer customer with given id
     * @throws IllegalArgumentException Throws if given identifier is null.
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public Customer getById(long id);
    
    /**
     * Create new Customer
     * @param customer Customer that should be store into DB
     * @throws IllegalArgumentException Throws if customer is null.
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public void create(Customer customer);
    
    /**
     * Update customer with given id if exist
     * @param customer Customer that should be updated
     * @throws IllegalArgumentException Throws if given customer is null.
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public void update(Customer customer);
    
    /**
     * Remove given customer if exist
     * @param customer Customer that should be removed from DB
     * @throws IllegalArgumentException Throws if given customer is null.
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public void remove(Customer customer);
    
    /**
     * Return all customers
     * @return List<Customer> List of all Customers in DB or empty List
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public List<Customer> findAll();
    
    /**
     * Return all customers with given Lastname
     * @param lastName lastname of the Customers that we are looking for
     * @return List<Customer> List of all Customers with given Lastname (no diacritic) or empty List
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public List<Customer> findByLastName(String lastName);
    
    /**
     * Return Customer with given email
     * @param email email (the unique identificator) of the Customer that we are looking for
     * @return Customer customer with given email or null
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public Customer findByEmail(String email);
    
    /**
     * 
     * @param companyNumber the unique identificator of the company that we are looking for
     * @return Customer customer with given company number or null
     * @throws IllegalStateException Throws if manager is not initialized.
     */
    public Customer findByCompanyNumber(String companyNumber);
}
